<{include file="public/header.html"}>
<div class="nloan-lists">
    <header class="bj-white follow-head">
        <a href="<{eval url('loan/index')}>" class="iconfont icon-search-back"></a>
        <h1 class="bar-title"><{if $keyword}>关键词：<{$keyword}><input type="hidden" name="keyWord" id="keyWord" value="<{$keyword}>"/><{else}>找贷款<{/if}></h1>
        <a href="<{eval url('loan/search')}>?kw=<{$hot_search}>" class="iconfont fr icon-go-search">&#xe7ba;</a>
    </header>
    <div class="mt50 nlists">
        <div class="nav-list">
            <dl id="top-menu" class="topmenu f-cb">
                <dt>
                    <div class="selectlist">
                        <div class="select_textdiv">
                            <input type="hidden" value="<{if $amount_id > 0}><{$amount_id}><{else}>0<{/if}>" id="amount_id">
                            <p class="s_text <{if $amount_id > 0}>colf0706f<{/if}>"><{if $amount_id > 0}><{$default_amount_type['title']}><{else}>金额不限<{/if}></p><span class="down iconfont <{if $amount_id > 0}>colf0706f<{/if}>"><{if $amount_id > 0}>&#xe657;<{else}>&#xe633;<{/if}></span>
                        </div>
                        <div class="select_textul" style="width: 980px; display: none;">
                            <ul class="select_first_ul" name="amount_id">
                                <li>
                                    <p style="width: 100%;" itemid="0">金额不限</p>
                                </li>
                                <{foreach from=$amount_type item=val}>
                                <li class="<{if $amount_id == $val['id'] }>focus<{/if}> ">
                                    <p style="width: 100%;" itemid="<{$val['id']}>"><{$val['title']}></p>
                                </li>
                                <{/foreach}>
                            </ul>
                        </div>
                    </div>
                </dt>
                <dt>
                    <div class="selectlist">
                        <div class="select_textdiv">
                            <input type="hidden" value="" id="period_id">
                            <p class="s_text">期限不限</p><span class="down iconfont">&#xe633;</span>
                        </div>
                        <div class="select_textul" style="width: 980px; display: none;">
                            <ul class="select_first_ul" name="period_id">
                                <li>
                                    <p style="width: 100%;" itemid="0">期限不限</p>
                                </li>
                                <{foreach from=$period_type item=val}>
                                <li>
                                    <p style="width: 100%;" itemid="<{$val['id']}>"><{$val['title']}></p>
                                </li>
                                <{/foreach}>
                            </ul>
                        </div>
                    </div>
                </dt>
                <dt>
                    <div class="selectlist">
                        <div class="select_textdiv divfocus">
                            <input type="hidden" value="" id="lend_id">
                            <p class="s_text <{if $lend_id > 0}>colf0706f<{/if}>"><{if $lend_id > 0}><{$default_type['title']}><{else}>类型不限<{/if}></p><span class="down iconfont <{if $lend_id > 0}>colf0706f<{/if}>"><{if $lend_id > 0}>&#xe657;<{else}>&#xe633;<{/if}></span>
                        </div>
                        <div class="select_textul" style="width: 980px; display: none;">
                            <ul class="select_first_ul" name="lend_id">
                                <li>
                                    <p style="width: 100%;" itemid="0">类型不限</p>
                                </li>
                                <{foreach from=$lend_type item=val}>
                                <li class="<{if $lend_id == $val['id'] }>focus<{/if}>">
                                    <p style="width: 100%;" itemid="<{$val['id']}>"><{$val['title']}></p>
                                </li>
                                <{/foreach}>
                            </ul>
                        </div>
                    </div>
                </dt>
                <dt>
                    <div class="selectlist">
                        <div class="select_textdiv divfocus">
                            <input type="hidden" value="" id="orderby">
                            <p class="s_text">综合排序</p><span class="down iconfont">&#xe633;</span>
                        </div>
                        <div class="select_textul" style="width: 980px; display: none;">
                            <ul class="select_first_ul" name="orderby">
                                <li>
                                    <p style="width: 100%;" itemid="0">综合排序</p>
                                </li>
                                <li>
                                    <p style="width: 100%;" itemid="amount">额度由高-低</p>
                                </li>
                                <li>
                                    <p style="width: 100%;" itemid="rate">利率由低-高</p>
                                </li>
                                <li>
                                    <p style="width: 100%;" itemid="tip">放款速度</p>
                                </li>
                            </ul>
                        </div>
                    </div>
                </dt>
            </dl>
        </div>
        <div class="all-lists" >
            <ul id="content-list" class="hot-lists">

            </ul>
            <div class="loading" id="noresults" <{if $list}>style="display: none;"<{/if}>>
             <a href="javascript:;" class="load-success empty-follow-data">没有任何数据哦</a>
            </div>
            <div class="loading" id="loading"  style="display: none;">
                <a class="/*pull-load*/ load-success" href="javascript:;">加载中...</a>
            </div>
            <div class="loading" id="nomoreresults" style="display: none;">
                <a href="javascript:;" class="load-success nomore-load">已经到底啦~~~</a>
            </div>
        </div>

    </div>
</div>

<script type="text/javascript" src="/static/js/scrollpagination.js"></script>
<script type="text/javascript" src="/static/js/loan-min-1.0.js"></script>
<script type="text/javascript">
    var scrollPagination_obj = null;
    $(function(){
        if(parseInt("<{$lend_id}>") > 0){
            LOAN_CIG.lendType = "<{$lend_id}>";
            //console.log(LOAN_CIG.pageIndex);
        }
        if(("<{$keyword}>").length > 0){
            LOAN_CIG.keyWord = "<{$keyword}>";
        }
        $('#content-list').scrollPagination({
            'contentPage': "/ajax/ajax_search_more_loan_json_new",
            'contentData': {
                'amount_id': LOAN_CIG.amountId,
                'period_id':LOAN_CIG.periodId,
                'lend_id':LOAN_CIG.lendType,
                'keyWord':LOAN_CIG.keyWord,
                'orderby': LOAN_CIG.orderBy,
                'pageIndex': LOAN_CIG.pageIndex
            },
            'scrollTarget': $(window),
            'heightOffset': 0,
            'initLoad':function(){
                scrollPagination_obj = this;
            },
            'beforeLoad': function() { // before load function, you can display a preloader div
                $('#loading').fadeIn('fast');
                $('#loading').attr('scrollpagination','disabled');
            },
            'afterLoad': function(elementsLoaded) { // after loading content, you can use this function to animate your new elements
                //console.log(elementsLoaded);
                $('#loading').fadeOut('fast');
                $('#loading').attr('scrollpagination','enabled');
                if (elementsLoaded.length == 0) {
                    $('#nomoreresults').fadeIn('slow');
                    $('#content-list').stopScrollPagination();
                }else{
                    LOAN_CIG.pageIndex = LOAN_CIG.pageIndex + 1;
                    //console.log(LOAN_CIG.pageIndex)
                }

                this.contentData.pageIndex = LOAN_CIG.pageIndex;
                $(elementsLoaded).fadeInWithDelay();
            }
        });
        $.fn.fadeInWithDelay = function() {
            var delay = 0;
            return this.each(function() {
                $(this).delay(delay).animate({
                    opacity: 1
                }, 200);
                delay += 100;
            });
        };
    });
</script>

<{include file="public/footer.html"}>